package com.anzia.pagejump.slice;

import com.anzia.pagejump.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Text;

public class ThirdAbilitySlice extends AbilitySlice {
	@Override
	public void onStart(Intent intent) {
		super.onStart(intent);
		super.setUIContent(ResourceTable.Layout_ability_3);

		// 通过组件id获取组件
		Text text = (Text) findComponentById(ResourceTable.Id_ability_text_3);
		text.setClickedListener(component -> {
			Intent intent1 = new Intent();
			intent1.setParam("pwd", "51cto");	// 设置参数
			setResult(intent1);	// 设置返回的结果
			terminate();	// 点击事件结束后销毁该slice
		});

	}

	@Override
	public void onActive() {
		super.onActive();
	}

	@Override
	public void onForeground(Intent intent) {
		super.onForeground(intent);
	}
}
